// require.ensure 是 Webpack 的特殊语法，用来设置 code-split point
import App from '../App.vue'
import Home from '../views/index.vue'
import GoodsClassify from '../views/goods/classify.vue'
import VideoList from '../views/video/list.vue'
import CartList from '../views/cart/list.vue'
import My from '../views/my.vue'
// const Home = r => require.ensure([], () => r(require('../views/index.vue')), 'pages/home')
const GoodsDetail = r => require.ensure([], () => r(require('../views/goods/detail.vue')), 'pages/goods/detail')
const GoodsList = r => require.ensure([], () => r(require('../views/goods/goodsList.vue')), 'pages/goods/goodsList')
const AddressList = r => require.ensure([], () => r(require('../views/address/list.vue')), 'pages/address/list')
const ShopAddressList = r => require.ensure([], () => r(require('../views/address/shop.vue')), 'pages/address/shop')
const AddressAdd = r => require.ensure([], () => r(require('../views/address/add.vue')), 'pages/address/add')
const AddressEdit = r => require.ensure([], () => r(require('../views/address/edit.vue')), 'pages/address/edit')
const OrderConfirm = r => require.ensure([], () => r(require('../views/order/confirm.vue')), 'pages/order/confirm')
const OrderList = r => require.ensure([], () => r(require('../views/order/list.vue')), 'pages/order/list')
const OrderDetail = r => require.ensure([], () => r(require('../views/order/detail.vue')), 'pages/order/detail')
const OrderExpress = r => require.ensure([], () => r(require('../views/order/express.vue')), 'pages/order/express')
const OrderAgent = r => require.ensure([], () => r(require('../views/order/agent.vue')), 'pages/order/agent')
const OrderSuccess = r => require.ensure([], () => r(require('../views/order/success.vue')), 'pages/order/success')
const IntegralList = r => require.ensure([], () => r(require('../views/member/integral.vue')), 'pages/member/integral')
const BalanceList = r => require.ensure([], () => r(require('../views/member/balance.vue')), 'pages/member/balance')
const MemberSpread = r => require.ensure([], () => r(require('../views/member/spread.vue')), 'pages/member/spread')
const MemberRegister = r => require.ensure([], () => r(require('../views/member/register.vue')), 'pages/member/register')
const NoticeList = r => require.ensure([], () => r(require('../views/notice/list.vue')), 'pages/notice/list')
const NoticeDetail = r => require.ensure([], () => r(require('../views/notice/detail.vue')), 'pages/notice/detail')
const CommentAdd = r => require.ensure([], () => r(require('../views/comment/add.vue')), 'pages/comment/add')
const VideoDetail = r => require.ensure([], () => r(require('../views/video/detail.vue')), 'pages/video/detail')
const CommentList = r => require.ensure([], () => r(require('../views/comment/list.vue')), 'pages/comment/list')
const RefundList = r => require.ensure([], () => r(require('../views/refund/list.vue')), 'pages/refund/list')
const RefundGoodsAdd = r => require.ensure([], () => r(require('../views/refund/goods/add.vue')), 'pages/refund/goods/add')
const RefundGoodsList = r => require.ensure([], () => r(require('../views/refund/goods/list.vue')), 'pages/refund/goods/list')
const RefundGoodsDetail = r => require.ensure([], () => r(require('../views/refund/goods/detail.vue')), 'pages/refund/goods/detail')
const RefundGoodsExpressAdd = r => require.ensure([], () => r(require('../views/refund/goods/express/add.vue')), 'pages/refund/goods/express/add')
const RefundGoodsExpressDetail = r => require.ensure([], () => r(require('../views/refund/goods/express/detail.vue')), 'pages/refund/goods/express/detail')
const RefundMoneyAdd = r => require.ensure([], () => r(require('../views/refund/money/add.vue')), 'pages/refund/money/add')
const RefundMoneyDetail = r => require.ensure([], () => r(require('../views/refund/money/detail.vue')), 'pages/refund/money/detail')
const SettingIndex = r => require.ensure([], () => r(require('../views/setting/index.vue')), 'pages/setting/index')
const Password = r => require.ensure([], () => r(require('../views/setting/password.vue')), 'pages/setting/password')
const Name = r => require.ensure([], () => r(require('../views/setting/name.vue')), 'pages/setting/name')
const NewsList = r => require.ensure([], () => r(require('../views/news/list.vue')), 'pages/news/list')
const NewsDetail = r => require.ensure([], () => r(require('../views/news/detail.vue')), 'pages/news/detail')
const BalconyList = r => require.ensure([], () => r(require('../views/balcony/list.vue')), 'pages/balcony/list')
const ActiveList = r => require.ensure([], () => r(require('../views/active/list.vue')), 'pages/active/list')
const ActiveGoodsList = r => require.ensure([], () => r(require('../views/active/goodsList.vue')), 'pages/active/goodsList')
const CollectList = r => require.ensure([], () => r(require('../views/collect/list.vue')), 'pages/collect/list')
const SearchGoods = r => require.ensure([], () => r(require('../views/search/goods.vue')), 'pages/search/goods')
const InvitedMember = r => require.ensure([], () => r(require('../views/invited/member.vue')), 'pages/invited/member')
const InvitedOrder = r => require.ensure([], () => r(require('../views/invited/order.vue')), 'pages/invited/order')
const LoginPassword = r => require.ensure([], () => r(require('../views/login/password.vue')), 'pages/login/password')
const LoginMessage = r => require.ensure([], () => r(require('../views/login/message.vue')), 'pages/login/message')
const LoginBind = r => require.ensure([], () => r(require('../views/login/bind.vue')), 'pages/login/bind')
const Iframe = r => require.ensure([], () => r(require('../views/iframe.vue')), 'pages/iframe')
const CouponIndex = r => require.ensure([], () => r(require('../views/coupon/index.vue')), 'pages/coupon/index')
const CouponMember = r => require.ensure([], () => r(require('../views/coupon/member.vue')), 'pages/coupon/member')
const CouponDetail = r => require.ensure([], () => r(require('../views/coupon/detail.vue')), 'pages/coupon/detail')
const Search = r => require.ensure([], () => r(require('../views/search/search.vue')), 'pages/search/search')
const UpgradeVip = r => require.ensure([], () => r(require('../views/member/upgradeVip.vue')), 'pages/member/upgradeVip')
const Advice = r => require.ensure([], () => r(require('../views/setting/advice.vue')), 'pages/setting/advice')
const ModifyMobile = r => require.ensure([], () => r(require('../views/setting/modifyMobile.vue')), 'pages/setting/modifyMobile')
const ModifyMobileNext = r => require.ensure([], () => r(require('../views/setting/modifyMobileNext.vue')), 'pages/setting/modifyMobileNext')
const MemberBank = r => require.ensure([], () => r(require('../views/member/bank.vue')), 'pages/member/bank')
const MemberWithdrawal = r => require.ensure([], () => r(require('../views/member/withdrawal.vue')), 'pages/member/withdrawal')
const MemberDetails = r => require.ensure([], () => r(require('../views/member/details.vue')), 'pages/member/details')
const UnionIndex = r => require.ensure([], () => r(require('../views/union/index.vue')), 'pages/union/index')
const MemberNovice = r => require.ensure([], () => r(require('../views/member/novice.vue')), 'pages/member/novice')
const MemberGuarantee = r => require.ensure([], () => r(require('../views/member/guarantee.vue')), 'pages/member/guarantee')
const BankAdd = r => require.ensure([], () => r(require('../views/member/bankadd.vue')), 'pages/member/bankadd')
const BankEdit = r => require.ensure([], () => r(require('../views/member/bankedit.vue')), 'pages/member/bankedit')
const WatchMaintenance = r => require.ensure([], () => r(require('../views/watch/maintenance.vue')), 'pages/member/maintenance')
// 关于设置
const SettingFinishData = r => require.ensure([], () => r(require('../views/setting/finish-data.vue')), 'pages/setting/finish-data')
// 关于手表维护
const WatchClass = r => require.ensure([], () => r(require('../views/watch/class.vue')), 'pages/member/class')
// 体验店
const Experience = r => require.ensure([], () => r(require('../views/union/experience.vue')), 'pages/union/experience')
// 手表回收
const recycling = r => require.ensure([], () => r(require('../views/watch/recycling.vue')), 'pages/watch/recycling')
const PayResultConfirm = r => require.ensure([], () => r(require('../views/order/payResultConfirm.vue')), 'pages/order/payResultConfirm')
// 退货相关
const goodsReturnService = r => require.ensure([], () => r(require('../views/goods/return/service.vue')), 'pages/goods/return/service')
const goodsReturnServiceReturn = r => require.ensure([], () => r(require('../views/goods/return/serviceReturn.vue')), 'pages/goods/return/serviceReturn')
const goodsReturnServiceRefund = r => require.ensure([], () => r(require('../views/goods/return/ServiceRefund.vue')), 'pages/goods/return/ServiceRefund')
const refundDetail = r => require.ensure([], () => r(require('../views/refund/detail.vue')), 'pages/refund/detail')
const goodsReturnAfter = r => require.ensure([], () => r(require('../views/goods/return/after-sale_check.vue')), 'pages/goods/return/after-sale_check')
// 下载相关
const About = r => require.ensure([], () => r(require('../views/setting/about.vue')), 'pages/setting/about')
const Download = r => require.ensure([], () => r(require('../views/setting/download.vue')), 'pages/setting/download')
// 客服页面
const serviceCustom = r => require.ensure([], () => r(require('../views/login/service.vue')), 'pages/login/service')
// 直径页面
const diameter = r => require.ensure([], () => r(require('../views/goods/diameter.vue')), 'pages/goods/diameter')

const scrollBehavior = (to, from, savedPosition) => {
  return {x: 0, y: 0}
}
let list = [
  {
    path: '*',
    name: 'default',
    component: Home,
    meta: {
      login: true
    }
  },
  {
    path: '/',
    name: 'app',
    component: App, // 顶级路由
    children: [ // 二级路由
      {
        path: '/',
        name: 'home',
        component: Home,
        meta: {
          // keepAlive: true,
          login: true
        }
      },
      {
        path: '/goods/classify',
        name: 'goods-classify',
        component: GoodsClassify,
        meta: {
          keepAlive: false,
          login: true
        }
      },
      {
        path: 'order/payResultConfirm',
        name: 'order-pay-result-confirm',
        component: PayResultConfirm
      },
      {
        path: '/video/list',
        name: 'video-list',
        component: VideoList,
        meta: {
          login: true
        }
      },
      {
        path: '/cart/list',
        name: 'cart-list',
        component: CartList,
        meta: {
          login: true
        }
      },
      {
        path: '/my',
        name: 'my',
        component: My,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/goods/detail/:id',
        name: 'goods-detail',
        component: GoodsDetail,
        meta: {
          login: true
        }
      },
      {
        path: '/goods/goodsList',
        name: 'goods-list',
        component: GoodsList,
        meta: {
          login: true
        }
      },
      {
        path: '/address/list',
        name: 'address-list',
        component: AddressList,
        meta: {
          login: true
        }
      },
      {
        path: '/address/shop',
        name: 'address-shop',
        component: ShopAddressList,
        meta: {
          login: true
        }
      },
      {
        path: '/address/add',
        name: 'address-add',
        component: AddressAdd,
        meta: {
          login: true
        }
      },
      {
        path: '/address/edit/:id',
        name: 'address-edit',
        component: AddressEdit,
        meta: {
          login: true
        }
      },
      {
        path: '/order/confirm',
        name: 'order-confirm',
        component: OrderConfirm,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/list',
        name: 'order-list',
        component: OrderList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/detail/:id',
        name: 'order-detail',
        component: OrderDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/express/:id',
        name: 'order-express',
        component: OrderExpress,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/agent',
        name: 'order-agent',
        component: OrderAgent,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/order/success',
        name: 'order-success',
        component: OrderSuccess,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/member/integral',
        name: 'member-integral',
        component: IntegralList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/member/balance',
        name: 'member-balance',
        component: BalanceList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/member/spread',
        name: 'member-spread',
        component: MemberSpread,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/member/register',
        name: 'member-register',
        component: MemberRegister,
        meta: {
          login: true
        }
      },
      {
        path: '/video/detail/:id',
        name: 'video-detail',
        component: VideoDetail,
        meta: {
          login: true
        }
      },
      {
        path: '/notice/list',
        name: 'notice-list',
        component: NoticeList,
        meta: {
          login: true
        }
      },
      {
        path: '/notice/detail/:id',
        name: 'notice-detail',
        component: NoticeDetail,
        meta: {
          login: true
        }
      },
      {
        path: '/comment/add/:id',
        name: 'comment-add',
        component: CommentAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/comment/list/:id',
        name: 'comment-list',
        component: CommentList,
        meta: {
          login: true
        }
      },
      {
        path: '/refund/list',
        name: 'refund-list',
        component: RefundList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/detail/:id',
        name: 'refund-goods-detail',
        component: RefundGoodsDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/list/:orderId/:goodsId',
        name: 'refund-goods-list',
        component: RefundGoodsList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/add/:orderId/:goodsId',
        name: 'refund-goods-add',
        component: RefundGoodsAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/express/add',
        name: 'refund-goods-express-add',
        component: RefundGoodsExpressAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/goods/express/detail/:id',
        name: 'refund-goods-express-detail',
        component: RefundGoodsExpressDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/money/add/:orderId/:goodsId',
        name: 'refund-money-add',
        component: RefundMoneyAdd,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/refund/money/detail/:id',
        name: 'refund-money-detail',
        component: RefundMoneyDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/setting/index',
        name: 'setting-index',
        component: SettingIndex,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/setting/password',
        name: 'setting-password',
        component: Password,
        meta: {
          login: false,
          auth: false
        }
      },
      {
        path: '/setting/name',
        name: 'setting-name',
        component: Name,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/news/list',
        name: 'news-list',
        component: NewsList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: '/news/detail/:id',
        name: 'news-detail',
        component: NewsDetail,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'active/list',
        name: 'active-list',
        component: ActiveList,
        meta: {
          login: true
        }
      },
      {
        path: 'active/goodsList/:id',
        name: 'active-goods-list',
        component: ActiveGoodsList,
        meta: {
          login: true
        }
      },
      {
        path: 'balcony/list',
        name: 'balcony-list',
        component: BalconyList,
        meta: {
          login: true
        }
      },
      {
        path: 'collect/list',
        name: 'collect-list',
        component: CollectList,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'search/goods',
        name: 'search-goods',
        component: SearchGoods,
        meta: {
          login: true
        }
      },
      {
        path: 'invited/member',
        name: 'invited-member',
        component: InvitedMember,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'invited/order/:id',
        name: 'invited-order',
        component: InvitedOrder,
        meta: {
          login: true,
          auth: true
        }
      },
      {
        path: 'login/password',
        name: 'login-password',
        component: LoginPassword
      },
      {
        path: 'login/message',
        name: 'login-message',
        component: LoginMessage
      },
      {
        path: 'login/bind',
        name: 'login-bind',
        component: LoginBind
      },
      {
        path: '/iframe',
        name: 'iframe',
        component: Iframe,
        meta: {
          login: true
        }
      },
      {
        path: '/coupon/index',
        name: 'coupon-index',
        component: CouponIndex,
        meta: {
          login: true
        }
      },
      {
        path: '/coupon/member',
        name: 'coupon-member',
        component: CouponMember,
        meta: {
          login: true
        }
      },
      {
        path: '/coupon/detail',
        name: 'coupon-detail',
        component: CouponDetail,
        meta: {
          login: true
        }
      },
      {
        path: '/search/search',
        name: 'search-search',
        component: Search,
        meta: {
          login: true
        }
      },
      {
        path: '/member/upgradeVip',
        name: 'upgrade-vip',
        component: UpgradeVip,
        meta: {
          login: true
        }
      },
      {
        path: '/setting/advice',
        name: 'setting-advice',
        component: Advice,
        meta: {
          login: true
        }
      },
      {
        path: '/setting/modifyMobile',
        name: 'modify-mobile',
        component: ModifyMobile,
        meta: {
          login: true
        }
      },
      {
        path: '/setting/modifyMobileNext',
        name: 'modify-mobilenext',
        component: ModifyMobileNext,
        meta: {
          login: true
        }
      },
      {
        path: '/setting/finish-data',
        name: 'setting-finish-data',
        component: SettingFinishData,
        meta: {
          login: true
        }
      },
      {
        path: '/member/bank',
        name: 'member-bank',
        component: MemberBank,
        meta: {
          login: true
        }
      },
      {
        path: '/member/withdrawal',
        name: 'member-withdrawal',
        component: MemberWithdrawal,
        meta: {
          login: true
        }
      },
      {
        path: '/member/details',
        name: 'member-details',
        component: MemberDetails,
        meta: {
          login: true
        }
      },
      {
        path: '/union/index',
        name: 'union-index',
        component: UnionIndex,
        meta: {
          login: true
        }
      },
      {
        path: '/member/novice',
        name: 'member-novice',
        component: MemberNovice,
        meta: {
          login: true
        }
      },
      {
        path: '/member/guarantee',
        name: 'member-guarantee',
        component: MemberGuarantee,
        meta: {
          login: true
        }
      },
      {
        path: '/member/bankadd',
        name: 'member-bankadd',
        component: BankAdd,
        meta: {
          login: true
        }
      },
      {
        path: '/member/bankedit',
        name: 'member-bankedit',
        component: BankEdit,
        meta: {
          login: true
        }
      },
      {
        path: '/watch/maintenance',
        name: 'watch-maintenance',
        component: WatchMaintenance,
        meta: {
          login: true
        }
      },
      {
        path: '/watch/class',
        name: 'watch-class',
        component: WatchClass,
        meta: {
          login: true
        }
      },
      {
        path: '/union/experience',
        name: 'union-experience',
        component: Experience,
        meta: {
          login: true
        }
      },
      {
        path: '/watch/recycling',
        name: 'watch-recycling',
        component: recycling,
        meta: {
          login: true
        }
      },
      {
        path: '/goods/return/service',
        name: 'return-service',
        component: goodsReturnService,
        meta: {
          login: true
        }
      },
      {
        path: '/goods/return/serviceReturn',
        name: 'return-service-return',
        component: goodsReturnServiceReturn,
        meta: {
          login: true
        }
      },
      {
        path: '/goods/return/serviceRefund/:id',
        name: 'return-service-refund',
        component: goodsReturnServiceRefund,
        meta: {
          login: true
        }
      },
      {
        path: '/refund/detail',
        name: 'refund-detail',
        component: refundDetail,
        meta: {
          login: true
        }
      },
      {
        path: 'setting/about',
        name: 'setting-about',
        component: About
      },
      {
        path: 'setting/download',
        name: 'setting-download',
        component: Download
      },
      {
        path: 'after/sale',
        name: 'after-sale',
        component: goodsReturnAfter
      },
      {
        path: 'login/service',
        name: 'login-service',
        component: serviceCustom
      },
      {
        path: 'goods/diameter',
        name: 'goods-diameter',
        component: diameter
      }
    ]
  }
]

// 合并公共路由
// routers = routers.concat(commonRouter)

export {list, scrollBehavior}

